2 include_once( "SpecialRecentchanges.php" );
4 function wfSpecialRecentchangeslinked( $par = NULL )
6 global $wgUser, $wgOut, $wgLang, $wgTitle;
7 global $days, $target, $hideminor; # From query string
8 $days = $_REQUEST["days"];
9 $hideminor = $_REQUEST["hideminor"];
10 $from = $_REQUEST["from"];
12 $fname = "wfSpecialRecentchangeslinked";
14 $wgOut->setPagetitle( wfMsg( "recentchanges" ) );
15 $sk = $wgUser->getSkin();
20 if ( "" == $target ) {
21 $wgOut->errorpage( "notargettitle", "notargettext" );
24 $nt = Title
::newFromURL( $target );
25 $wgOut->setSubtitle( wfMsg( "rclsub", $nt->getPrefixedText() ) );
28 $days = $wgUser->getOption( "rcdays" );
29 if ( ! $days ) { $days = 7; }
32 list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" );
33 $cutoff = wfUnix2Timestamp( time() - ( $days * 86400 ) );
35 if ( ! isset( $hideminor ) ) {
36 $hideminor = $wgUser->getOption( "hideminor" );
39 $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
40 WfMsg( "show" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
41 "&days={$days}&limit={$limit}&hideminor=0" );
43 $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
44 WfMsg( "hide" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
45 "&days={$days}&limit={$limit}&hideminor=1" );
48 $cmq = "AND cur_minor_edit=0";
51 $sql = "SELECT cur_id,cur_namespace,cur_title,cur_user,cur_comment," .
52 "cur_user_text,cur_timestamp,cur_minor_edit,cur_is_new FROM links, cur " .
53 "WHERE cur_timestamp > '{$cutoff}' {$cmq} AND l_to=cur_id AND l_from='" .
54 wfStrencode( $nt->getPrefixedDBkey() ) . "' GROUP BY cur_id " .
55 "ORDER BY inverse_timestamp LIMIT {$limit}";
56 $res = wfQuery( $sql, DB_READ
, $fname );
58 $note = wfMsg( "rcnote", $limit, $days );
59 $wgOut->addHTML( "<hr>\n{$note}\n<br>" );
61 $tu = "target=" . $nt->getPrefixedURL();
62 $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked", $tu );
63 $wgOut->addHTML( "{$note}\n" );
65 $s = $sk->beginRecentChangesList();
66 $count = wfNumRows( $res );
69 if ( 0 == $count ) { break; }
70 $obj = wfFetchObject( $res );
73 $ts = $obj->cur_timestamp
;
75 $ut = $obj->cur_user_text
;
76 $ns = $obj->cur_namespace
;
77 $ttl = $obj->cur_title
;
78 $com = $obj->cur_comment
;
79 $me = ( $obj->cur_minor_edit
> 0 );
80 $new = ( $obj->cur_is_new
> 0 );
82 $s .= $sk->recentChangesLine( $ts, $u, $ut, $ns, $ttl, $com, $me, $new );
85 $s .= $sk->endRecentChangesList();
88 $wgOut->addHTML( $s );